<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateConfigsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('configs', function (Blueprint $table) {
            $table->increments('id')->comment('ID');
            $table->unsignedInteger('category_id')->index()->comment('分类ID');
            $table->string('type')->default('input')->comment('类型');
            $table->string('name', 50)->comment('名称');
            $table->string('slug', 50)->index()->comment('标识');
            $table->string('desc')->nullable()->comment('描述');
            $table->string('options')->nullable()->comment('选项');
            $table->string('value', 5000)->nullable()->comment('默认值');
            $table->text('validation_rules')->nullable()->comment('验证规则');
            $table->boolean('form_disabled')->nullable()->default(false)->comment('表单是否禁用');
            $table->boolean('order')->nullable()->default(false)->comment('排序');
            $table->dateTime('created_at')->nullable()->comment('创建时间');
            $table->dateTime('updated_at')->nullable()->comment('更新时间');
            $table->softDeletes()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('configs');
    }
}
